Q5: Planetary orbits
We want to consider planetary orbits. To do this, we need to solve Newton’s second law together with Newton’s law of gravity. If we restrict ourselves to the x-y plane, then there are 4 quantities we need to solve for: \(x\), \(y\), \(v_x\), and \(v_y\). These evolve according to:
\begin{align*} \frac{dx}{dt} &= v_x \\ \frac{dy}{dt} &= v_y \\ \frac{dv_x}{dt} &= a_x = -\frac{GM_\star x}{r^3} \\ \frac{dv_y}{dt} &= a_y = -\frac{GM_\star y}{r^3} \end{align*}
To integrate these forward in time, we need an initial condition for each quantity. We’ll setup our system such that the Sun is at the origin (that will be one focus), and the planet begins at perihelion and orbits counterclockwise.
The distance of perihelion from the focus is:
where \(a\) is the semi-major axis and \(e\) is the eccentricity. The perihelion velocity is all in the \(y\) direction and is:
We’ll work in units of AU, years, and solar masses, in which case, \(GM_\star = 4\pi^2\) (for the Sun).
Your initial conditions should be:
\(x(t=0) = r_p\)
\(y(t=0) = 0\)
\(v_x(t=0) = 0\)
\(v_y(t=0) = v_p\)
Use the scipy ODE integration methods to integrate an orbit and plot it
[6]:
from BicoccaCoursePython2024.quarta_lezione import planet
Earth = planet()
Earth.integrate_motion_equations()
ani= Earth.animate_jnb()
[7]:
ani
[7]: